package com.xyf.sys.mapper;

import com.xyf.sys.domain.OrderProduct;
import com.xyf.sys.domain.User;
import com.xyf.sys.vo.OrderUserResult;
import com.xyf.sys.vo.SaleCountResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface OrderProductMapper {
    int deleteByPrimaryKey(String id);

    int insert(OrderProduct record);

    int insertSelective(OrderProduct record);

    OrderProduct selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(OrderProduct record);

    int updateByPrimaryKey(OrderProduct record);

    List<OrderProduct> selectByOrderId(@Param("orderId") String orderId);

    OrderProduct selectByCode(@Param("code") String code);

    Integer count(@Param("goodsId") Long goodsId, @Param("date")  String date);

    List<SaleCountResult> countSaleAndTotalStock(@Param("goodsIds") List<Long> goodsIds, @Param("date")  String date);

    List<User>  selectLastOrderUser(@Param("goodsId") Long goodsId);

    List<OrderUserResult> findGoodsUsers(@Param("goodsIds") List<Long> goodsIds);

    OrderProduct selectByOrderIdAndCartItemId(@Param("orderId") String orderId, @Param("cartItemId") Long cartItemId);

    OrderProduct selectByWaybillId(@Param("waybillId") String waybillId);
}